﻿@model Bieb.Web.Models.People.ViewPersonModel

@{
    ViewBag.Title = Model.FullName;
}


@if (User.Identity.IsAuthenticated)
{
    <nav class="navbar navbar-default">
        <div class="container-fluid">
            @using (Html.BeginForm("Delete", "People", FormMethod.Post, new { @class = "navbar-form navbar-left" }))
            {
                @Html.AntiForgeryToken()
                @Html.HiddenFor(model => model.Id)
                
                <a href="@Url.Action("Create", "People")" class="btn btn-default">
                    <i class="glyphicon glyphicon-star"></i>
                    <span class="hidden-xs">@BiebResources.SharedStrings.CreateNew</span>
                </a>
                
                <a href="@Url.Action("Edit", "People", new { Model.Id })" class="btn btn-default">
                    <i class="glyphicon glyphicon-pencil"></i>
                    <span class="hidden-xs">@BiebResources.SharedStrings.Edit</span>
                </a>
                
                <button class="btn btn-default" type="submit" onclick="return confirm('@BiebResources.SharedStrings.SimpleConfirmQuestion')">
                    <i class="glyphicon glyphicon-trash"></i>
                    <span class="hidden-xs">@BiebResources.SharedStrings.Delete</span>
                </button>
            }
        </div>
    </nav>
}

<div class="row">

    <div class="col-md-4">
        @{ Html.RenderPartial("Card", Model); }
    </div>

    <div class="col-md-8">
        <p>@Model.ReviewText</p>
        
        @if (Model.AuthoredBooks.Any())
        {
            <h2>@BiebResources.PeopleStrings.AuthoredBooks</h2>
            Html.RenderPartial("~/Views/Books/ItemList.cshtml", Model.AuthoredBooks);
        }

        @if (Model.EditedBooks.Any())
        {
            <h2>@BiebResources.PeopleStrings.EditedBooks</h2>
            Html.RenderPartial("~/Views/Books/ItemList.cshtml", Model.EditedBooks);
        }

        @if (Model.TranslatedBooks.Any())
        {
            <h2>@BiebResources.PeopleStrings.TranslatedBooks</h2>
            Html.RenderPartial("~/Views/Books/ItemList.cshtml", Model.TranslatedBooks);
        }

        @if (Model.TranslatedStories.Any())
        {
            <h2>@BiebResources.PeopleStrings.TranslatedStories</h2>
            Html.RenderPartial("~/Views/Stories/ItemList.cshtml", Model.TranslatedStories);
        }

        @if (Model.AuthoredStories.Any())
        {
            // TODO: Split between short stories and novels
            <h2>@BiebResources.PeopleStrings.AuthoredStories</h2>
            Html.RenderPartial("~/Views/Stories/ItemList.cshtml", Model.AuthoredStories);
        }

        @{ Html.RenderPartial("MoreInfo", Model); }
    </div>

</div>
